<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        //1return终止函数
        function getsum(a, b) {
            return a + b;
            alert('这条语句会执行吗');   //不会
        }
        console.log(getsum(1, 2));


        //2只能返回一个值
        function fn(c, d) {
            return c, d;
        }
        console.log(fn(1, 2));

        //3求任意两个数，加减乘除结果
        function getresult(num1, num2) {
            return [num1 + num2, num1 - num2, num1 * num2, num1 / num2];

        }
        var re = getresult(1, 2);//返回的是一个数组
        console.log(re);

        //函数有return，就返回return值，没有的话反汇编undefined
        function fn(r, t) {
            //没有return
        }
        console.log(fn(1, 2));//函数返回结果为undefined
    </script>
</head>

<body>

</body>

</html>